﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPageContent.master" AutoEventWireup="false" CodeFile="Supplier2.aspx.vb" Inherits="Tools_Supplier2" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
     <%--<link href="../Design/Presence/style/style.css" rel="stylesheet" type="text/css" />--%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <%--<link href="../Design/Presence/style/style.css" rel="stylesheet" type="text/css" />--%>

        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="rgUsers">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgUsers" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Telerik" Transparency="20">
        </telerik:RadAjaxLoadingPanel>

         
         <br /><br />

      <telerik:RadGrid ID="rgUsers" runat="server" GridLines="None" DataSourceID="odsUser"
                    AllowAutomaticDeletes="True" AllowAutomaticInserts="True" 
                    Width="100%" AllowAutomaticUpdates="True" SkinID="rgSkin" AllowPaging="true"
                    AutoGenerateColumns="False"  MasterTableView-Dir="<%$ Resources:SystemResource, HTMLDirectionality %>"
                    GroupPanel-Text="<%$ Resources:MainGrid ,GroupPanelText %>" CellSpacing="0" OnItemDataBound="OnItemDataBoundHandler" PageSize="10">
                    <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="ID"
                        TableLayout="Fixed" DataSourceID="odsUser" HorizontalAlign="NotSet"
                        NoMasterRecordsText="<%$ Resources:MainGrid , NoMasterRecordsText %>">
                        <CommandItemTemplate>
                         <asp:ImageButton  id="ibtnInitInsert" CommandName="InitInsert"  runat="server"  ImageUrl="~/Design/images/Grid/AddRecord.gif"  />                          
                            &nbsp;&nbsp;
                             <asp:LinkButton ID="lbtnInitInsert" runat="server" Font-Size="Large" Text="<%$ Resources:MainGrid , AddNew %>"
                                CommandName="InitInsert" Visible="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <asp:ImageButton  id="ibtnEditSelected" CommandName="EditSelected"  runat="server"  ImageUrl="~/Design/images/Grid/Edit.gif"  />
                            &nbsp;&nbsp;
                            <asp:LinkButton ID="lbtnEditSelected" runat="server" Font-Size="Large" Text="<%$ Resources:MainGrid , EditSelected %>"
                                CommandName="EditSelected" Visible="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <asp:ImageButton  id="ibtnDeleteSelected" CommandName="DeleteSelected"  runat="server"  ImageUrl="~/Design/images/Grid/Delete.gif"  />&nbsp;&nbsp;
                            <asp:LinkButton
                                ID="lbtnDeleteSelected" Font-Size="Large" OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>"
                                runat="server" Text="<%$ Resources:MainGrid , DeleteSelected %>" CommandName="DeleteSelected" />&nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <asp:ImageButton  id="ibtnRebindGrid" CommandName="DeleteSelected"  runat="server"  ImageUrl="~/Design/images/Grid/Refresh.gif"  />&nbsp;&nbsp;
                            <asp:LinkButton
                                ID="lbtnRebindGrid" Font-Size="Large" runat="server" Text="<%$ Resources:MainGrid , Refresh %>"
                                CommandName="RebindGrid" />
                        </CommandItemTemplate>
   <Columns>
                       
                       
                            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"  ButtonType="ImageButton">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </telerik:GridEditCommandColumn>

                            <telerik:GridBoundColumn DataField="id" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                                UniqueName="User_ID" Visible="false">
                            </telerik:GridBoundColumn>
                            
                            <telerik:GridBoundColumn DataField="UserName" meta:ResourceKey="gbcUserName"
                                SortExpression="UserName" UniqueName="UName" >
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px"  />
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn DataField="Password" meta:ResourceKey="gbcPassword"
                                SortExpression="Password" UniqueName="Password"  >
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn DataField="emp_Num" meta:ResourceKey="gbcemp_Num"
                                SortExpression="emp_Num" UniqueName="emp_Num"  >
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </telerik:GridBoundColumn>
                            
                            <%--<telerik:GridCheckBoxColumn DataField="Admin" HeaderText="Is Admin" SortExpression="Admin"
                                UniqueName="Admin" EditFormColumnIndex="1" DataType="System.Boolean" ReadOnly="true">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </telerik:GridCheckBoxColumn>--%> 

                                     
                            <telerik:GridBoundColumn DataField="FName" meta:ResourceKey="gbcemp_Name" ReadOnly="True" SortExpression="FName"
                                UniqueName="User_FName" Visible="true">
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="180px" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="180px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridButtonColumn UniqueName="DeleteColumn" ConfirmText="<%$ Resources:MainGrid , ConfirmDelete %>" ConfirmTitle="Confirm" ButtonType="ImageButton" CommandName="Delete" >
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </telerik:GridButtonColumn>
                                  
                       </Columns>


                <EditFormSettings ColumnNumber="2" EditFormType="Template" CaptionDataField="UserName" CaptionFormatString="Edit properties of {0}" InsertCaption="New User">
               
                   <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                    <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                    <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                        Width="100%" />
                    <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                    <EditColumn ButtonType="ImageButton" InsertText="Insert User" UpdateText="Update record"
                        UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                    </EditColumn>
                    <FormTableButtonRowStyle HorizontalAlign="Left" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                
                
              
              <FormTemplate>
              
              
              <table id="Table2" cellspacing="2" cellpadding="1" border ="0" rules="none" >
                                    
                  <tr style="margin-bottom:40px">
                  <td>
                        <asp:Label ID="lblNewUser" Font-Bold="true" Font-Italic="true" runat="server" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "New User", "Update User") %>' SkinID="KeyLabel"></asp:Label> 
                        
                  </td>
                  </tr>
                  <tr>
                  <td>
                       <asp:Label ID="lblMantxtUserName" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>" ></asp:Label>
                       <asp:Label ID="lblUserName" runat="server" Text="User Name :" SkinID="KeyLabel" ></asp:Label>
                       &nbsp;&nbsp;
                  </td>
                  <td>
                       <telerik:RadTextBox ID="rtbUserName" runat="server" Width="250px" 
                        Text='<%# Bind("UserName") %>'>
                       </telerik:RadTextBox> 
                   </td>
                   <td>
                        <asp:RequiredFieldValidator ID="rfvrtbUserName" runat="server" ControlToValidate="rtbUserName" ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valEditMode"></asp:RequiredFieldValidator>
                   </td>
                  </tr>



                  <tr>
                  <td>
                       <asp:Label ID="lblMantxtPass" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>" ></asp:Label>
                       <asp:Label ID="lblPass" runat="server" Text="Password :" SkinID="KeyLabel" ></asp:Label>
                        &nbsp;&nbsp;
                  </td>
                  <td>
                       <telerik:RadTextBox ID="rtbPass" TextMode="Password" Width="250px" runat="server" 
                        Text='<%# Bind("Password") %>'>
                       </telerik:RadTextBox> 
                   </td>
                   <td>
                        <asp:RequiredFieldValidator ID="rfvrtbPass" runat="server" ControlToValidate="rtbPass" ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valEditMode"></asp:RequiredFieldValidator>
                   </td>
                  </tr>


                  <tr>
                  <td>
                       <asp:Label ID="lblManrcbEmployee" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>" ></asp:Label>
                       <asp:Label ID="lblrcbEmployee" runat="server" Text="Employee :"  SkinID="KeyLabel"></asp:Label>
                        &nbsp;&nbsp;
                  </td>
                  <td>
                       <telerik:RadComboBox runat="server" ID="rcbEmployee" EnableLoadOnDemand = "true" SkinID="cbSkin"
                            OnItemsRequested="rcbEmployee_ItemsRequested" AutoPostBack="true" Height="150px"
                            HighlightTemplatedItems="true" Width="250px" DropDownWidth="250px" OnSelectedIndexChanged="OnSelectedIndexChangedHandler"
                            DataTextField = "FName" DataValueField="emp_Num">
                            <HeaderTemplate>
                                <ul>
                                <li class="col1">Number</li>
                                <li class="col2">Name</li>
                                  
                                </ul>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <ul>
                                    <li class="col1">
                                        <%# DataBinder.Eval(Container, "Attributes('emp_Num')")%></li>
                                    <li class="col2">
                                        <%# DataBinder.Eval(Container, "Attributes('FName')")%>
                                    </li>
                                
                                </ul>
                            </ItemTemplate>
                        </telerik:RadComboBox> 
                   </td>
                   <td>
                        <asp:RequiredFieldValidator ID="rfvrcbEmployee" runat="server" ControlToValidate="rcbEmployee" ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valEditMode"></asp:RequiredFieldValidator>
                   </td>
                  </tr>
                  <%--<tr>
                    <td><asp:Label ID="lblAdmin" SkinID="KeyLabel" runat="server" Text="Is Admin: "></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td>
                        <asp:CheckBox ID="chkIsAdmin" Checked='<%# Bind("Admin") %>' SkinID="KeyCheckBox" runat="server" /> 
                    </td>
                  </tr>--%>


                  <tr>
                   
                   <td colspan="2" style="margin-top:15px">
                     <asp:ImageButton ID="ibtnbtnEdtInsert" ImageUrl="~/Design/images/Update.gif" runat="server" CommandName="PerformInsert" ValidationGroup="valEditMode" Text="Add" ToolTip="AddUser"  Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "True", "False") %>'/>
                     <asp:ImageButton ID="ibtnbtnEdtUpdate" ImageUrl="~/Design/images/Update.gif" runat="server" CommandName="Update" ValidationGroup="valEditMode" Text="Update" ToolTip="Update"  Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>' />
                     <asp:ImageButton ID="ibtnbtnEdtCancel" ImageUrl="~/Design/images/Cancel.gif" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="False" ToolTip="Cancel" />                            
                   </td>
                 </tr>


        </table>


              </FormTemplate>                
   
                </EditFormSettings>

                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline="False" HorizontalAlign="Center" Wrap="True"   />
                    </MasterTableView>
                    <ValidationSettings CommandsToValidate="PerformInsert,Update" ValidationGroup="valEditMode" />
                    <ClientSettings AllowDragToGroup="False">
                        <Scrolling AllowScroll="false" ScrollHeight="400px"   />
                        <Selecting AllowRowSelect="True" />
                    </ClientSettings>
                    <FilterMenu EnableTheming="True">
                        <CollapseAnimation Duration="200" Type="OutQuint" />
                    </FilterMenu>
                     <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                </telerik:RadGrid>





      

                
        <asp:ObjectDataSource ID="odsUser" runat="server" 
    DeleteMethod="QueryDatabase" InsertMethod="QueryDatabase" 
    SelectMethod="QueryDatabase" TypeName="UserSP" 
    UpdateMethod="QueryDatabase" >
            <DeleteParameters>
                <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="deleteUser" Name="Operation" Type="String" />
                <asp:Parameter Name="ID" Type="String" />
                <asp:Parameter Name="emp_Num" Type="String" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="Password" Type="String" />
                <%--<asp:Parameter Name="Admin" Type="String" />--%>
                <asp:Parameter Name="FName" Type="String" />
                <asp:Parameter Name="LName" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="SaveUser" Name="Operation" Type="String" />
                <asp:Parameter Name="ID" Type="String" />
                <asp:SessionParameter SessionField="emp_Num" Name="emp_Num" Type="String" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="Password" Type="String" />
                <%--<asp:Parameter Name="Admin" Type="String" />--%>
                <asp:Parameter Name="FName" Type="String" />
                <asp:Parameter Name="LName" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="GetUser" Name="Operation" Type="String" />
                <asp:Parameter Name="ID" Type="String" />
                <asp:Parameter Name="emp_Num" Type="String" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="Password" Type="String" />
                <%--<asp:Parameter Name="Admin" Type="String" />--%>
                <asp:Parameter Name="FName" Type="String" />
                <asp:Parameter Name="LName" Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter DefaultValue="0" Name="QueryType" Type="Object" />
                <asp:Parameter DefaultValue="UpdateUser" Name="Operation" Type="String" />
                <asp:Parameter Name="ID" Type="String" />
                <asp:SessionParameter SessionField="emp_Num" Name="emp_Num" Type="String" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="Password" Type="String" />
                <%--<asp:Parameter Name="Admin" Type="String" />--%>
                <asp:Parameter Name="FName" Type="String" />
                <asp:Parameter Name="LName" Type="String" />
            </UpdateParameters>
    </asp:ObjectDataSource>






</asp:Content>